package flst.ipiweb.service;

import java.util.List;

import flst.ipiweb.persistance.dao.DAOFactory;
import flst.ipiweb.transverse.Article;
import flst.ipiweb.transverse.IPIException;

public class ServiceArticle {

	public void createArticle(Article article) throws IPIException{
	  DAOFactory.getInstance().getArticleDao().createArticle(article);
	}

	public void updateArticle(Article article) throws IPIException{
	  DAOFactory.getInstance().getArticleDao().updateArticle(article);
	}

	public List<Article> listerArticles() throws IPIException{
	  return DAOFactory.getInstance().getArticleDao().listerArticles();
	}

	public void deleteArticle(Article article) throws IPIException{
		DAOFactory.getInstance().getArticleDao().deleteArticle(article);
	}

	public Integer genererRefArticle() {
	  return DAOFactory.getInstance().getArticleDao().GenererRefArticle();
	}

	public List<Article> rechercheArticleByRef(int refArticle) throws IPIException {
	  return DAOFactory.getInstance().getArticleDao().RechercheArticleByRef(refArticle);
	}

	public List<Article> rechercheArticleByPrice(Double price) throws IPIException {
	  return DAOFactory.getInstance().getArticleDao().RechercheArticleByPrice(price);
	}

	public List<Article> rechercheArticleByDescription(String description) throws IPIException{
	  return DAOFactory.getInstance().getArticleDao().RechercheArticleByDescription(description);
	}

	public Article getArticleById(int idArticle) throws IPIException{
	  return DAOFactory.getInstance().getArticleDao().getArticleById(idArticle);
	}
}
